﻿using System;
using System.Collections.Generic;

namespace Jayden.Dll.Web.Styles
{
	public class CssPropertyDescription : IComparable<CssPropertyDescription>
	{

		private string m_Name;
		private string m_Description;
		private int m_CssVersion;

		public CssPropertyDescription(string name, string description, int cssVesrion)
		{
			m_Name = name;
#if DEBUG
			// do not store the description in release mode
			m_Description = description;
#endif
			m_CssVersion = cssVesrion;
		}

		public string Name { get { return m_Name; } }
		public string Description { get { return m_Description; } }
		public int CssVersion { get { return m_CssVersion; } }

		private static Dictionary<string, CssPropertyDescription> m_ByName;

		public static int GetVersion(string name)
		{
			CssPropertyDescription d;
			if (m_ByName.TryGetValue(name, out d))
				return d.CssVersion;
			if (name.StartsWith("-"))
				return 0;
			return -1;
		}

		static CssPropertyDescription()
		{
			m_ByName = new Dictionary<string, CssPropertyDescription>();
			foreach (CssPropertyDescription d in m_Descriptions)
				m_ByName.Add(d.Name, d);
		}

		#region Descriptions array

		public static IEnumerable<CssPropertyDescription> Descriptions { get { return m_Descriptions; } }

		private static CssPropertyDescription[] m_Descriptions = new CssPropertyDescription[] {
			new CssPropertyDescription("@keyframes","Specifies the animation",3),
			new CssPropertyDescription("animation","A shorthand property for all the animation properties below, except the animation-play-state property",3),
			new CssPropertyDescription("animation-name","Specifies a name for the @keyframes animation",3),
			new CssPropertyDescription("animation-duration","Specifies how many seconds or milliseconds an animation takes to complete one cycle",3),
			new CssPropertyDescription("animation-timing-function","Specifies the speed curve of the animation",3),
			new CssPropertyDescription("animation-delay","Specifies when the animation will start",3),
			new CssPropertyDescription("animation-iteration-count","Specifies the number of times an animation should be played",3),
			new CssPropertyDescription("animation-direction","Specifies whether or not the animation should play in reverse on alternate cycles",3),
			new CssPropertyDescription("animation-play-state","Specifies whether the animation is running or paused",3),
			new CssPropertyDescription("background","Sets all the background properties in one declaration",1),
			new CssPropertyDescription("background-attachment","Sets whether a background image is fixed or scrolls with the rest of the page",1),
			new CssPropertyDescription("background-color","Sets the background color of an element",1),
			new CssPropertyDescription("background-image","Sets the background image for an element",1),
			new CssPropertyDescription("background-position","Sets the starting position of a background image",1),
			new CssPropertyDescription("background-repeat","Sets how a background image will be repeated",1),
			new CssPropertyDescription("background-clip","Specifies the painting area of the background",3),
			new CssPropertyDescription("background-origin","Specifies the positioning area of the background images",3),
			new CssPropertyDescription("background-size","Specifies the size of the background images",3),
			new CssPropertyDescription("border","Sets all the border properties in one declaration",1),
			new CssPropertyDescription("border-bottom","Sets all the bottom border properties in one declaration",1),
			new CssPropertyDescription("border-bottom-color","Sets the color of the bottom border",1),
			new CssPropertyDescription("border-bottom-style","Sets the style of the bottom border",1),
			new CssPropertyDescription("border-bottom-width","Sets the width of the bottom border",1),
			new CssPropertyDescription("border-color","Sets the color of the four borders",1),
			new CssPropertyDescription("border-left","Sets all the left border properties in one declaration",1),
			new CssPropertyDescription("border-left-color","Sets the color of the left border",1),
			new CssPropertyDescription("border-left-style","Sets the style of the left border",1),
			new CssPropertyDescription("border-left-width","Sets the width of the left border",1),
			new CssPropertyDescription("border-right","Sets all the right border properties in one declaration",1),
			new CssPropertyDescription("border-right-color","Sets the color of the right border",1),
			new CssPropertyDescription("border-right-style","Sets the style of the right border",1),
			new CssPropertyDescription("border-right-width","Sets the width of the right border",1),
			new CssPropertyDescription("border-style","Sets the style of the four borders",1),
			new CssPropertyDescription("border-top","Sets all the top border properties in one declaration",1),
			new CssPropertyDescription("border-top-color","Sets the color of the top border",1),
			new CssPropertyDescription("border-top-style","Sets the style of the top border",1),
			new CssPropertyDescription("border-top-width","Sets the width of the top border",1),
			new CssPropertyDescription("border-width","Sets the width of the four borders",1),
			new CssPropertyDescription("outline","Sets all the outline properties in one declaration",2),
			new CssPropertyDescription("outline-color","Sets the color of an outline",2),
			new CssPropertyDescription("outline-style","Sets the style of an outline",2),
			new CssPropertyDescription("outline-width","Sets the width of an outline",2),
			new CssPropertyDescription("border-bottom-left-radius","Defines the shape of the border of the bottom-left corner",3),
			new CssPropertyDescription("border-bottom-right-radius","Defines the shape of the border of the bottom-right corner",3),
			new CssPropertyDescription("border-image","A shorthand property for setting all the border-image-* properties",3),
			new CssPropertyDescription("border-image-outset","Specifies the amount by which the border image area extends beyond the border box",3),
			new CssPropertyDescription("border-image-repeat","Specifies whether the image-border should be repeated, rounded or stretched",3),
			new CssPropertyDescription("border-image-slice","Specifies the inward offsets of the image-border",3),
			new CssPropertyDescription("border-image-source","Specifies an image to be used as a border",3),
			new CssPropertyDescription("border-image-width","Specifies the widths of the image-border",3),
			new CssPropertyDescription("border-radius","A shorthand property for setting all the four border-*-radius properties",3),
			new CssPropertyDescription("border-top-left-radius","Defines the shape of the border of the top-left corner",3),
			new CssPropertyDescription("border-top-right-radius","Defines the shape of the border of the top-right corner",3),
			new CssPropertyDescription("box-decoration-break","",3),
			new CssPropertyDescription("box-shadow","Attaches one or more drop-shadows to the box",3),
			new CssPropertyDescription("overflow-x","Specifies whether or not to clip the left/right edges of the content, if it overflows the element's content area",3),
			new CssPropertyDescription("overflow-y","Specifies whether or not to clip the top/bottom edges of the content, if it overflows the element's content area",3),
			new CssPropertyDescription("overflow-style","Specifies the preferred scrolling method for elements that overflow",3),
			new CssPropertyDescription("rotation","Rotates an element around a given point defined by the rotation-point property",3),
			new CssPropertyDescription("rotation-point","Defines a point as an offset from the top left border edge",3),
			new CssPropertyDescription("color-profile","Permits the specification of a source color profile other than the default",3),
			new CssPropertyDescription("opacity","Sets the opacity level for an element",3),
			new CssPropertyDescription("rendering-intent","Permits the specification of a color profile rendering intent other than the default",3),
			new CssPropertyDescription("bookmark-label","Specifies the label of the bookmark",3),
			new CssPropertyDescription("bookmark-level","Specifies the level of the bookmark",3),
			new CssPropertyDescription("bookmark-target","Specifies the target of the bookmark link",3),
			new CssPropertyDescription("float-offset","Pushes floated elements in the opposite direction of the where they have been floated with float",3),
			new CssPropertyDescription("hyphenate-after","Specifies the minimum number of characters in a hyphenated word after the hyphenation character",3),
			new CssPropertyDescription("hyphenate-before","Specifies the minimum number of characters in a hyphenated word before the hyphenation character",3),
			new CssPropertyDescription("hyphenate-character","Specifies a string that is shown when a hyphenate-break occurs",3),
			new CssPropertyDescription("hyphenate-lines","Indicates the maximum number of successive hyphenated lines in an element",3),
			new CssPropertyDescription("hyphenate-resource","Specifies a comma-separated list of external resources that can help the browser determine hyphenation points",3),
			new CssPropertyDescription("hyphens","Sets how to split words to improve the layout of paragraphs",3),
			new CssPropertyDescription("image-resolution","Specifies the correct resolution of images",3),
			new CssPropertyDescription("marks","Adds crop and/or cross marks to the document",3),
			new CssPropertyDescription("string-set","",3),
			new CssPropertyDescription("height","Sets the height of an element",1),
			new CssPropertyDescription("max-height","Sets the maximum height of an element",2),
			new CssPropertyDescription("max-width","Sets the maximum width of an element",2),
			new CssPropertyDescription("min-height","Sets the minimum height of an element",2),
			new CssPropertyDescription("min-width","Sets the minimum width of an element",2),
			new CssPropertyDescription("width","Sets the width of an element",1),
			new CssPropertyDescription("box-align","Specifies how to align the child elements of a box",3),
			new CssPropertyDescription("box-direction","Specifies in which direction the children of a box are displayed",3),
			new CssPropertyDescription("box-flex","Specifies whether the children of a box is flexible or inflexible in size",3),
			new CssPropertyDescription("box-flex-group","Assigns flexible elements to flex groups",3),
			new CssPropertyDescription("box-lines","Specifies whether columns will go onto a new line whenever it runs out of space in the parent box",3),
			new CssPropertyDescription("box-ordinal-group","Specifies the display order of the child elements of a box",3),
			new CssPropertyDescription("box-orient","Specifies whether the children of a box should be laid out horizontally or vertically",3),
			new CssPropertyDescription("box-pack","Specifies the horizontal position in horizontal boxes and the vertical position in vertical boxes",3),
			new CssPropertyDescription("font","Sets all the font properties in one declaration",1),
			new CssPropertyDescription("font-family","Specifies the font family for text",1),
			new CssPropertyDescription("font-size","Specifies the font size of text",1),
			new CssPropertyDescription("font-style","Specifies the font style for text",1),
			new CssPropertyDescription("font-variant","Specifies whether or not a text should be displayed in a small-caps font",1),
			new CssPropertyDescription("font-weight","Specifies the weight of a font",1),
			new CssPropertyDescription("@font-face","A rule that allows websites to download and use fonts other than the 'web-safe' fonts",3),
			new CssPropertyDescription("font-size-adjust","Preserves the readability of text when font fallback occurs",3),
			new CssPropertyDescription("font-stretch","Selects a normal, condensed, or expanded face from a font family",3),
			new CssPropertyDescription("content","Used with the :before and :after pseudo-elements, to insert generated content",2),
			new CssPropertyDescription("counter-increment","Increments one or more counters",2),
			new CssPropertyDescription("counter-reset","Creates or resets one or more counters",2),
			new CssPropertyDescription("quotes","Sets the type of quotation marks for embedded quotations",2),
			new CssPropertyDescription("crop","Allows a replaced element to be just a rectangular area of an object, instead of the whole object",3),
			new CssPropertyDescription("move-to","Causes an element to be removed from the flow and reinserted at a later point in the document",3),
			new CssPropertyDescription("page-policy","Determines which page-based occurance of a given element is applied to a counter or string value",3),
			new CssPropertyDescription("grid-columns","Specifies the width of each column in a grid",3),
			new CssPropertyDescription("grid-rows","Specifies the height of each column in a grid",3),
			new CssPropertyDescription("target","A shorthand property for setting the target-name, target-new, and target-position properties",3),
			new CssPropertyDescription("target-name","Specifies where to open links (target destination)",3),
			new CssPropertyDescription("target-new","Specifies whether new destination links should open in a new window or in a new tab of an existing window",3),
			new CssPropertyDescription("target-position","Specifies where new destination links should be placed",3),
			new CssPropertyDescription("alignment-adjust","Allows more precise alignment of elements",3),
			new CssPropertyDescription("alignment-baseline","Specifies how an inline-level element is aligned with respect to its parent",3),
			new CssPropertyDescription("baseline-shift","Allows repositioning of the dominant-baseline relative to the dominant-baseline",3),
			new CssPropertyDescription("dominant-baseline","Specifies a scaled-baseline-table",3),
			new CssPropertyDescription("drop-initial-after-adjust","Sets the alignment point of the drop initial for the primary connection point",3),
			new CssPropertyDescription("drop-initial-after-align","Sets which alignment line within the initial line box is used at the primary connection point with the initial letter box",3),
			new CssPropertyDescription("drop-initial-before-adjust","Sets the alignment point of the drop initial for the secondary connection point",3),
			new CssPropertyDescription("drop-initial-before-align","Sets which alignment line within the initial line box is used at the secondary connection point with the initial letter box",3),
			new CssPropertyDescription("drop-initial-size","Controls the partial sinking of the initial letter",3),
			new CssPropertyDescription("drop-initial-value","Activates a drop-initial effect",3 ),
			new CssPropertyDescription("inline-box-align","Sets which line of a multi-line inline block align with the previous and next inline elements within a line",3),
			new CssPropertyDescription("line-stacking","A shorthand property for setting the line-stacking-strategy, line-stacking-ruby, and line-stacking-shift properties",3),
			new CssPropertyDescription("line-stacking-ruby","Sets the line stacking method for block elements containing ruby annotation elements",3),
			new CssPropertyDescription("line-stacking-shift","Sets the line stacking method for block elements containing elements with base-shift",3),
			new CssPropertyDescription("line-stacking-strategy","Sets the line stacking strategy for stacked line boxes within a containing block element",3),
			new CssPropertyDescription("text-height","Sets the block-progression dimension of the text content area of an inline box",3),
			new CssPropertyDescription("list-style","Sets all the properties for a list in one declaration",1),
			new CssPropertyDescription("list-style-image","Specifies an image as the list-item marker",1),
			new CssPropertyDescription("list-style-position","Specifies if the list-item markers should appear inside or outside the content flow",1),
			new CssPropertyDescription("list-style-type","Specifies the type of list-item marker",1),
			new CssPropertyDescription("margin","Sets all the margin properties in one declaration",1),
			new CssPropertyDescription("margin-bottom","Sets the bottom margin of an element",1),
			new CssPropertyDescription("margin-left","Sets the left margin of an element",1),
			new CssPropertyDescription("margin-right","Sets the right margin of an element",1),
			new CssPropertyDescription("margin-top","Sets the top margin of an element",1),
			new CssPropertyDescription("marquee-direction","Sets the direction of the moving content",3),
			new CssPropertyDescription("marquee-play-count","Sets how many times the content move",3),
			new CssPropertyDescription("marquee-speed","Sets how fast the content scrolls",3),
			new CssPropertyDescription("marquee-style","Sets the style of the moving content",3),
			new CssPropertyDescription("column-count","Specifies the number of columns an element should be divided into",3),
			new CssPropertyDescription("column-fill","Specifies how to fill columns",3),
			new CssPropertyDescription("column-gap","Specifies the gap between the columns",3),
			new CssPropertyDescription("column-rule","A shorthand property for setting all the column-rule-* properties",3),
			new CssPropertyDescription("column-rule-color","Specifies the color of the rule between columns",3),
			new CssPropertyDescription("column-rule-style","Specifies the style of the rule between columns",3),
			new CssPropertyDescription("column-rule-width","Specifies the width of the rule between columns",3),
			new CssPropertyDescription("column-span","Specifies how many columns an element should span across",3),
			new CssPropertyDescription("column-width","Specifies the width of the columns",3),
			new CssPropertyDescription("columns","A shorthand property for setting column-width and column-count",3),
			new CssPropertyDescription("padding","Sets all the padding properties in one declaration",1),
			new CssPropertyDescription("padding-bottom","Sets the bottom padding of an element",1),
			new CssPropertyDescription("padding-left","Sets the left padding of an element",1),
			new CssPropertyDescription("padding-right","Sets the right padding of an element",1),
			new CssPropertyDescription("padding-top","Sets the top padding of an element",1),
			new CssPropertyDescription("fit","Gives a hint for how to scale a replaced element if neither its width nor its height property is auto",3),
			new CssPropertyDescription("fit-position","Determines the alignment of the object inside the box",3),
			new CssPropertyDescription("image-orientation","Specifies a rotation in the right or clockwise direction that a user agent applies to an image",3),
			new CssPropertyDescription("page","Specifies a particular type of page where an element SHOULD be displayed",3),
			new CssPropertyDescription("size","Specifies the size and orientation of the containing box for page content",3),
			new CssPropertyDescription("bottom","Specifies the bottom position of a positioned element",2),
			new CssPropertyDescription("clear","Specifies which sides of an element where other floating elements are not allowed",1),
			new CssPropertyDescription("clip","Clips an absolutely positioned element",2),
			new CssPropertyDescription("cursor","Specifies the type of cursor to be displayed",2),
			new CssPropertyDescription("display","Specifies how a certain HTML element should be displayed",1),
			new CssPropertyDescription("float","Specifies whether or not a box should float",1),
			new CssPropertyDescription("left","Specifies the left position of a positioned element",2),
			new CssPropertyDescription("overflow","Specifies what happens if content overflows an element's box",2),
			new CssPropertyDescription("position","Specifies the type of positioning method used for an element (static, relative, absolute or fixed)",2),
			new CssPropertyDescription("right","Specifies the right position of a positioned element",2),
			new CssPropertyDescription("top","Specifies the top position of a positioned element",2),
			new CssPropertyDescription("visibility","Specifies whether or not an element is visible",2),
			new CssPropertyDescription("z-index","Sets the stack order of a positioned element",2),
			new CssPropertyDescription("orphans","Sets the minimum number of lines that must be left at the bottom of a page when a page break occurs inside an element",2),
			new CssPropertyDescription("page-break-after","Sets the page-breaking behavior after an element",2),
			new CssPropertyDescription("page-break-before","Sets the page-breaking behavior before an element",2),
			new CssPropertyDescription("page-break-inside","Sets the page-breaking behavior inside an element",2),
			new CssPropertyDescription("widows","Sets the minimum number of lines that must be left at the top of a page when a page break occurs inside an element",2),
			new CssPropertyDescription("ruby-align","Controls the text alignment of the ruby text and ruby base contents relative to each other",3),
			new CssPropertyDescription("ruby-overhang","Determines whether, and on which side, ruby text is allowed to partially overhang any adjacent text in addition to its own base, when the ruby text is wider than the ruby base",3),
			new CssPropertyDescription("ruby-position","Controls the position of the ruby text with respect to its base",3),
			new CssPropertyDescription("ruby-span","Controls the spanning behavior of annotation elements",3),
			new CssPropertyDescription("mark","A shorthand property for setting the mark-before and mark-after properties",3),
			new CssPropertyDescription("mark-after","Allows named markers to be attached to the audio stream",3),
			new CssPropertyDescription("mark-before","Allows named markers to be attached to the audio stream",3),
			new CssPropertyDescription("phonemes","Specifies a phonetic pronunciation for the text contained by the corresponding element",3),
			new CssPropertyDescription("rest","A shorthand property for setting the rest-before and rest-after properties",3),
			new CssPropertyDescription("rest-after","Specifies a rest or prosodic boundary to be observed after speaking an element's content",3),
			new CssPropertyDescription("rest-before","Specifies a rest or prosodic boundary to be observed before speaking an element's content",3),
			new CssPropertyDescription("voice-balance","Specifies the balance between left and right channels",3),
			new CssPropertyDescription("voice-duration","Specifies how long it should take to render the selected element's content",3),
			new CssPropertyDescription("voice-pitch","Specifies the average pitch (a frequency) of the speaking voice",3),
			new CssPropertyDescription("voice-pitch-range","Specifies variation in average pitch",3),
			new CssPropertyDescription("voice-rate","Controls the speaking rate",3),
			new CssPropertyDescription("voice-stress","Indicates the strength of emphasis to be applied",3),
			new CssPropertyDescription("voice-volume","Refers to the amplitude of the waveform output by the speech synthesises",3),
			new CssPropertyDescription("border-collapse","Specifies whether or not table borders should be collapsed",2),
			new CssPropertyDescription("border-spacing","Specifies the distance between the borders of adjacent cells",2),
			new CssPropertyDescription("caption-side","Specifies the placement of a table caption",2),
			new CssPropertyDescription("empty-cells","Specifies whether or not to display borders and background on empty cells in a table",2),
			new CssPropertyDescription("table-layout","Sets the layout algorithm to be used for a table",2),
			new CssPropertyDescription("color","Sets the color of text",1),
			new CssPropertyDescription("direction","Specifies the text direction/writing direction",2),
			new CssPropertyDescription("letter-spacing","Increases or decreases the space between characters in a text",1),
			new CssPropertyDescription("line-height","Sets the line height",1),
			new CssPropertyDescription("text-align","Specifies the horizontal alignment of text",1),
			new CssPropertyDescription("text-decoration","Specifies the decoration added to text",1),
			new CssPropertyDescription("text-indent","Specifies the indentation of the first line in a text-block",1),
			new CssPropertyDescription("text-transform","Controls the capitalization of text",1),
			new CssPropertyDescription("unicode-bidi","",2),
			new CssPropertyDescription("vertical-align","Sets the vertical alignment of an element",1),
			new CssPropertyDescription("white-space","Specifies how white-space inside an element is handled",1),
			new CssPropertyDescription("word-spacing","Increases or decreases the space between words in a text",1),
			new CssPropertyDescription("hanging-punctuation","Specifies whether a punctuation character may be placed outside the line box",3),
			new CssPropertyDescription("punctuation-trim","Specifies whether a punctuation character should be trimmed",3),
			new CssPropertyDescription("text-align-last","Describes how the last line of a block or a line right before a forced line break is aligned when text-align is 'justify'",3),
			new CssPropertyDescription("text-justify","Specifies the justification method used when text-align is 'justify'",3),
			new CssPropertyDescription("text-outline","Specifies a text outline",3),
			new CssPropertyDescription("text-overflow","Specifies what should happen when text overflows the containing element",3),
			new CssPropertyDescription("text-shadow","Adds shadow to text",3),
			new CssPropertyDescription("text-wrap","Specifies line breaking rules for text",3),
			new CssPropertyDescription("word-break","Specifies line breaking rules for non-CJK scripts",3),
			new CssPropertyDescription("word-wrap","Allows long, unbreakable words to be broken and wrap to the next line",3),
			new CssPropertyDescription("transform","Applies a 2D or 3D transformation to an element",3),
			new CssPropertyDescription("transform-origin","Allows you to change the position on transformed elements",3),
			new CssPropertyDescription("transform-style","Specifies how nested elements are rendered in 3D space",3),
			new CssPropertyDescription("perspective","Specifies the perspective on how 3D elements are viewed",3),
			new CssPropertyDescription("perspective-origin","Specifies the bottom position of 3D elements",3),
			new CssPropertyDescription("backface-visibility","Defines whether or not an element should be visible when not facing the screen",3),
			new CssPropertyDescription("transition","A shorthand property for setting the four transition properties",3),
			new CssPropertyDescription("transition-property","Specifies the name of the CSS property the transition effect is for",3),
			new CssPropertyDescription("transition-duration","Specifies how many seconds or milliseconds a transition effect takes to complete",3),
			new CssPropertyDescription("transition-timing-function","Specifies the speed curve of the transition effect",3),
			new CssPropertyDescription("transition-delay","Specifies when the transition effect will start",3),
			new CssPropertyDescription("appearance","Allows you to make an element look like a standard user interface element",3),
			new CssPropertyDescription("box-sizing","Allows you to define certain elements to fit an area in a certain way",3),
			new CssPropertyDescription("icon","Provides the author the ability to style an element with an iconic equivalent",3),
			new CssPropertyDescription("nav-down","Specifies where to navigate when using the arrow-down navigation key",3),
			new CssPropertyDescription("nav-index","Specifies the tabbing order for an element",3),
			new CssPropertyDescription("nav-left","Specifies where to navigate when using the arrow-left navigation key",3),
			new CssPropertyDescription("nav-right","Specifies where to navigate when using the arrow-right navigation key",3),
			new CssPropertyDescription("nav-up","Specifies where to navigate when using the arrow-up navigation key",3),
			new CssPropertyDescription("outline-offset","Offsets an outline, and draws it beyond the border edge",3),
			new CssPropertyDescription("resize","Specifies whether or not an element is resizable by the user",3),
			new CssPropertyDescription("user-select","Specifies whether or not an element is selectable by the user",3),
			new CssPropertyDescription("zoom", "", 0),
			new CssPropertyDescription("filter", "", 0)
		};
		#endregion

		public int CompareTo(CssPropertyDescription other)
		{
			return m_Name.CompareTo(other.m_Name);
		}
	}
}
